#ifndef SAMPLES_SKYBOX_H
#define SAMPLES_SKYBOX_H
#include "SampleBase.h"
#include "glad\glad.h"
#include "Types.h"
#include "Sphere.h"
#include "HitableList.h"
#include "ImageParam.h"
#include "Camera.h"
#include "Lambertian.h"
#include "Rectangle.h"
#include "Metal.h"
#include "Glass.h"
#include <thread>
namespace RayTracer
{
	class SkyBoxSample : public SampleBase
	{
	public:
		SkyBoxSample() = default;
		~SkyBoxSample() = default;

		void Init();
		void Render();
		void ImGui();
		void ShutDown();
	private:
		vec3 RayColor(const Ray& ray, const Hitable& world, int depth);
		void Reset();
	private:
		GLuint mTexHandle = 0;
		ImageParam mImageParam; // output image
		int samples_per_pixel = 10;
		int maxDepth = 10;
		bool isNormal = false;
		// scene
		HitableList world;
		std::shared_ptr<Sphere> floor;
		std::shared_ptr<Sphere> center;

		std::shared_ptr<XY_Rect> xy_Rect;
		std::shared_ptr<XZ_Rect> xz_Rect;
		std::shared_ptr<YZ_Rect> yz_Rect;
		std::shared_ptr<YZ_Rect> yz_RectR;

		std::shared_ptr<Lambertian> floorMat;
		std::shared_ptr<Lambertian> xy_RectMat;
		std::shared_ptr<Lambertian> xz_RectMat;
		std::shared_ptr<Lambertian> yz_RectMat;
		std::shared_ptr<Lambertian> yz_RectRMat;
		std::shared_ptr<Metal> metalMat;
		std::shared_ptr<Glass> glassMat;
		float ir;
		float roughness;
		float radius;
		int currMat;
		bool isGenerate;
		int curIndex;
		// camera
		Camera camera;
		vec3 lookfrom;
		vec3 lookat;
		float fov;
		// viewport
		vec3 origin = vec3(0, 0, 0);
		vec3 horizontal;
		vec3 vertical;
		vec3 lower_left_corner;

		// sky color
		vec3 upColor;
		vec3 downColor;

		vec3 groundColor;
		vec3 sphereColor;

		vec3 frontColor;
		vec3 leftColor;
		vec3 rightColor;
		vec3 floorColor;
		
	};
}
#endif // !SAMPLES_SKYBOX_H
